package mylab.unitconversion;

public class WeightConverter {
	
	//stone used in here is UK stone.
	
	//milligrams to grams, kilograms, stones, ounces, pounds, short tons, long tons.
	public final static double MilligramsGramsFactor		= 1000.0;			//1 gram		= 1000 milligrams.
	public final static double MilligramsKiloGramsFactor	= 1000000.0;		//1 kilogram	= 1000000 milligrams.
	public final static double MilligramsTonsFactor			= 1000000000.0;		//1 ton			= 1000000000 milligrams.
	public final static double MilligramsStonesFactor		= 6350293.18;		//1 stone		= 6350293.18 milligrams.
	public final static double MilligramsOuncesFactor		= 28349.523125;		//1 ounce		= 28349.523125 milligrams.
	public final static double MilligramsPoundsFactor		= 453592.37;		//1 pound		= 453592.37 milligrams.
	public final static double MilligramsShortTonsFactor	= 907184740;		//1 short ton	= 907184740 milligrams.
	public final static double MilligramsLongTonsFactor		= 1016046908.8;		//1 long ton	= 1016046908.8 milligrams.
	
	public static double milligramsToGrams(double value){return value/MilligramsGramsFactor;}
	public static double gramsToMilligrams(double value){return value*MilligramsGramsFactor;}
	
	public static double milligramsToKilograms(double value){return value/MilligramsKiloGramsFactor;}
	public static double kilogramsToMilligrams(double value){return value*MilligramsKiloGramsFactor;}
	
	public static double milligramsToTons(double value){return value/MilligramsTonsFactor;}
	public static double tonsToMilligrams(double value){return value*MilligramsTonsFactor;}
	
	public static double milligramsToStones(double value){return value/MilligramsStonesFactor;}
	public static double stonesToMilligrams(double value){return value*MilligramsStonesFactor;}
	
	public static double milligramsToOunces(double value){return value/MilligramsOuncesFactor;}
	public static double ouncesToMilligrams(double value){return value*MilligramsOuncesFactor;}
	
	public static double milligramsToPounds(double value){return value/MilligramsPoundsFactor;}
	public static double poundsToMilligrams(double value){return value*MilligramsPoundsFactor;}
	
	public static double milligramsToShortTons(double value){return value/MilligramsShortTonsFactor;}
	public static double shortTonsToMilligrams(double value){return value*MilligramsShortTonsFactor;}
	
	public static double milligramsToLongTons(double value){return value/MilligramsLongTonsFactor;}
	public static double longTonsToMilligrams(double value){return value*MilligramsLongTonsFactor;}
	
	
	
	//grams to kilograms, stones, ounces, pounds, short tons, long tons.
	public final static double GramsKilogramsFactor			= 1000.0;			//1 kilogram	= 1000 grams.
	public final static double GramsTonsFactor				= 1000000.0;		//1 ton			= 1000000 grams.
	public final static double GramsStonesFactor			= 6350.29318;		//1 stone		= 6350.29318 grams.
	public final static double GramsOuncesFactor			= 28.349523125;		//1 ounce		= 28.349523125 grams.
	public final static double GramsPoundsFactor			= 453.59237;		//1 pound		= 453.59237 grams.
	public final static double GramsShortTonsFactor			= 907184.74;		//1 short ton	= 907184.74 grams.
	public final static double GramsLongTonsFactor			= 1016046.9088;		//1 long ton	= 1016046.9088 grams.
	
	public static double gramsToKilograms(double value){return value/GramsKilogramsFactor;}
	public static double kilogramsToGrams(double value){return value*GramsKilogramsFactor;}
	
	public static double gramsToTons(double value){return value/GramsTonsFactor;}
	public static double tonsToGrams(double value){return value*GramsTonsFactor;}
	
	public static double gramsToStones(double value){return value/GramsStonesFactor;}
	public static double stonesToGrams(double value){return value*GramsStonesFactor;}
	
	public static double gramsToOunces(double value){return value/GramsOuncesFactor;}
	public static double ouncesToGrams(double value){return value*GramsOuncesFactor;}
	
	public static double gramsToPounds(double value){return value/GramsPoundsFactor;}
	public static double poundsToGrams(double value){return value*GramsPoundsFactor;}
	
	public static double gramsToShortTons(double value){return value/GramsShortTonsFactor;}
	public static double shortTonsToGrams(double value){return value*GramsShortTonsFactor;}
	
	public static double gramsToLongTons(double value){return value/GramsLongTonsFactor;}
	public static double longTonsToGrams(double value){return value*GramsLongTonsFactor;}
	
	
	//kilograms to tons, stones, ounces, pounds, short tons, long tons.
	public final static double KilogramsTonsFactor			= 1000.0;			//1 ton			= 1000 kilograms.
	public final static double KilogramsStonesFactor		= 6.35029318;		//1 stone		= 6.35029318 kilograms.
	public final static double KilogramsOuncesFactor		= 35.27396195;		//1 kilograms	= 35.27396195 ounces.
	public final static double KilogramsPoundsFactor		= 2.204622622;		//1 kilograms	= 2.204622622 pounds.
	public final static double KilogramsShortTonsFactor		= 907.18474;		//1 short ton	= 907.18474 kilograms.
	public final static double KilogramsLongTonsFactor		= 1016.0469088;		//1 long ton	= 1016.0469088 kilograms.
	
	public static double kilogramsToTons(double value){return value/KilogramsTonsFactor;}
	public static double tonsToKilograms(double value){return value*KilogramsTonsFactor;}
	
	public static double kilogramsToStones(double value){return value/KilogramsStonesFactor;}
	public static double stonesToKilograms(double value){return value*KilogramsStonesFactor;}
	
	public static double kilogramsToOunces(double value){return value*KilogramsOuncesFactor;}
	public static double ouncesToKilograms(double value){return value/KilogramsOuncesFactor;}
	
	public static double kilogramsToPounds(double value){return value*KilogramsPoundsFactor;}
	public static double poundsToKilograms(double value){return value/KilogramsPoundsFactor;}
	
	public static double kilogramsToShortTons(double value){return value/KilogramsShortTonsFactor;}
	public static double shortTonsToKilograms(double value){return value*KilogramsShortTonsFactor;}
	
	public static double kilogramsToLongTons(double value){return value/KilogramsLongTonsFactor;}
	public static double longTonsToKilograms(double value){return value*KilogramsLongTonsFactor;}
	
	
	
	//tons to stones, ounces, pounds, short tons, long tons.
	public final static double TonsStonesFactor				= 157.473044;		//1 ton			= 157.473044 stones.
	public final static double TonsOuncesFactor				= 35273.96194958;	//1 ton			= 35273.96194958 ounces.
	public final static double TonsPoundsFactor				= 2204.622621849;	//1 ton			= 2204.622621849 pounds.
	public final static double TonsShortTonsFactor			= 1.102311311;		//1 ton			= 1.102311311 short tons.
	public final static double TonsLongTonsFactor			= 0.984206528;		//1 ton			= 0.984206528 long tons.
	
	public static double tonsToStones(double value){return value*TonsStonesFactor;}
	public static double stonesToTons(double value){return value/TonsStonesFactor;}
	
	public static double tonsToOunces(double value){return value*TonsOuncesFactor;}
	public static double ouncesToTons(double value){return value/TonsOuncesFactor;}
	
	public static double tonsToPounds(double value){return value*TonsPoundsFactor;}
	public static double poundsToTons(double value){return value/TonsPoundsFactor;}
	
	public static double tonsToShortTons(double value){return value*TonsShortTonsFactor;}
	public static double shortTonsToTons(double value){return value/TonsShortTonsFactor;}
	
	public static double tonsToLongTons(double value){return value*TonsLongTonsFactor;}
	public static double longTonsToTons(double value){return value/TonsLongTonsFactor;}
	
	
	
	//stones to ounces, pounds, short tons, long tons.
	public final static double StonesOuncesFactor			= 224;				//1 stone		= 224 ounces.
	public final static double StonesPoundsFactor			= 14;				//1 stone 		= 14 pounds.
	public final static double StonesShortTonsFactor		= 142.857142857;	//1 short ton	= 142.857142857 stones.
	public final static double StonesLongTonsFactor			= 160;				//1 long ton	= 160 stones.
	
	public static double stonesToOunces(double value){return value*StonesOuncesFactor;}
	public static double ouncesToStones(double value){return value/StonesOuncesFactor;}
	
	public static double stonesToPounds(double value){return value*StonesPoundsFactor;}
	public static double poundsToStones(double value){return value/StonesPoundsFactor;}
	
	public static double stonesToShortTons(double value){return value/StonesShortTonsFactor;}
	public static double shortTonsToStones(double value){return value*StonesShortTonsFactor;}
	
	public static double stonesToLongTons(double value){return value/StonesLongTonsFactor;}
	public static double longTonsToStones(double value){return value*StonesLongTonsFactor;}
	
	
	
	//ounces to pounds, short tons, long tons.
	public final static double OuncesPoundsFactor			= 16;				//1 pound		= 16 ounces.
	public final static double OuncesShortTonsFactor		= 32000;			//1 short ton	= 32000 ounces.
	public final static double OuncesLongTonsFactor			= 35840;			//1 long ton	= 35840 ounces.
	
	public static double ouncesToPounds(double value){return value/OuncesPoundsFactor;}
	public static double poundsToOunces(double value){return value*OuncesPoundsFactor;}
	
	public static double ouncesToShortTons(double value){return value/OuncesShortTonsFactor;}
	public static double shortTonsToOunces(double value){return value*OuncesShortTonsFactor;}
	
	public static double ouncesToLongTons(double value){return value/OuncesLongTonsFactor;}
	public static double longTonsToOunces(double value){return value*OuncesLongTonsFactor;}
	
	
	
	//pounds to short tons, long tons.
	public final static double PoundsShortTonsFactor		= 2000;				//1 short ton	= 2000 pounds.
	public final static double PoundsLongTonsFactor			= 2240;				//1 long ton	= 2240 pounds.
	
	public static double poundsToShortTons(double value){return value/PoundsShortTonsFactor;}
	public static double shortTonsToPounds(double value){return value*PoundsShortTonsFactor;}
	
	public static double poundsToLongTons(double value){return value/PoundsLongTonsFactor;}
	public static double longTonsToPounds(double value){return value*PoundsLongTonsFactor;}
	
	
	
	
	//short tons to long tons.
	public final static double ShortTonsLongTonsFactor		= 1.12;	 			//1 long ton	= 1.12 short tons.
	
	public static double shortTonsToLongTons(double value){return value/ShortTonsLongTonsFactor;}
	public static double longTonsToShortTons(double value){return value*ShortTonsLongTonsFactor;}
	
}
